function updateStatus() {
	var no_surat = document.updateform.no_surat.value;
	var tgl_surat = document.updateform.tgl_surat.value;
	if (no_surat == '') {
		alert("Anda belum mengisi nomor surat");
		return false;
	} else if (tgl_surat == '') {
		alert("Anda belum mengisi tanggal surat");
		return false;
	} else {
		return true;
	}
}

function submitStudent() {
	var nelement = document.studentform.elements.length;
	var checkedbox = 0;

	for (ii = 0; ii < nelement; ++ii) {
		var type = document.studentform.elements[ii].type;
		if (type == "checkbox" && document.studentform.elements[ii].checked) {
			++checkedbox;
		}
	}

	if (checkedbox == 0) {
		alert("Silakan pilih mahasiswa yang statusnya akan diubah.");
		return false;
	}
	else {
		return true;
	}
}

function cancelStudent() {
	var nelement = document.listform.elements.length;
	var checkedbox = 0;

	for (ii = 0; ii < nelement; ++ii) {
		var type = document.listform.elements[ii].type;
		if (type == "checkbox" && document.listform.elements[ii].checked) {
			++checkedbox;
		}
	}

	if (checkedbox == 0) {
		alert("Silakan pilih mahasiswa yang mau dihapus.");
		return false;
	}
	else {
		return true;
	}
}

function changeTopic(npm) {
	var selectind = 'mks_ind-';
	selectind = selectind.concat(npm);

	var selecting = 'mks_ing-';
	selecting = selecting.concat(npm);

	var selInd = document.getElementsByName(selectind);
	var selIng = document.getElementsByName(selecting);

	var selIndIdx = selInd[0].selectedIndex;

	var topik = selInd[0].options[selIndIdx].value;
	var topic = selIng[0].options[selIndIdx].value;

	var idInd = 'id_ind-';
	idInd = idInd.concat(npm);
	var idIng = 'id_ing-';
	idIng = idIng.concat(npm);

	var topik_ind = document.getElementById(idInd);
	var topik_ing = document.getElementById(idIng);

	topik_ind.innerHTML = topik;
	topik_ing.innerHTML = topic;
}

function UpdateGradeStudent() {
	var no_surat = document.pick.NO_SURAT.value;
	var nelement = document.pick.elements.length;
	var checkedbox = 0;

	for (ii = 0; ii < nelement; ++ii) {
		var type = document.pick.elements[ii].type;
		if (type == "checkbox" && document.pick.elements[ii].checked) {
			++checkedbox;
		}
	}

	if (no_surat == '') {
		alert("Nomor surat wajib diisi!");
		return false;
	}
	else if (checkedbox == 0) {
		alert("Silakan pilih mahasiswa yang nilainya akan diubah.");
		return false;
	}
	else {
		return true;
	}
}

function submitSearch() {
	var key = document.searchform.keyword.value;
	if (key.length < 3) {
		alert("Kata kunci minimal 3 huruf!");
		return false;
	}
	else {
		return true;
	}
}

function UpdateGradeClass() {
	var no_surat = document.pick.NO_SURAT.value;
	var nelement = document.pick.elements.length;
	var checkedbox = 0;

	for (ii = 0; ii < nelement; ++ii) {
		var type = document.pick.elements[ii].type;
		if (type == "checkbox" && document.pick.elements[ii].checked) {
			++checkedbox;
		}
	}

	if (no_surat == '') {
		alert("Nomor surat wajib diisi!");
		return false;
	}
	else if (checkedbox == 0) {
		alert("Silakan pilih kelas yang nilainya akan diubah.");
		return false;
	}
	else {
		return true;
	}
}

function freezeStudent() {
	var reason = document.freezeform.frz_st.value;

	if (reason == '') {
		alert("Silakan pilih keterangan pembekuan.");
		return false;
	}
	else {
		return true;
	}
}